//Thursday, January 19, 2012 17:51 PST
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
 
using namespace std;
 
class GogoXBallsAndBinsEasy {
public:
  int solve(vector <int>);
};
 
int GogoXBallsAndBinsEasy::solve(vector <int> T) {
  vector<int> v(T.begin(), T.end());
  sort(v.begin(), v.end());
  sort(T.begin(), T.end());
  int count = 0;
  do{
    int tmp = 0;
    for(int i=0; i<v.size(); i++){
      tmp += (v[i] - T[i]) >0? (v[i]-T[i]) : 0;
    }
    count = max(count, tmp>0? tmp:-tmp);
  }while(next_permutation(v.begin(), v.end()));
  return count;
}
 
 
//Powered by [KawigiEdit] 2.0!
